package com.jqb.struts2lab01.action;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

import com.opensymphony.xwork2.ActionSupport;

public class GobalAction extends ActionSupport {

	private static final long serialVersionUID = 1L;

	private String name;

	public String execute() {

		/**
		 * 处理通过get方式直接传给Action的中文参数 :name
		 */
		try {
			name = URLEncoder.encode(name, "ISO8859-1");
			name = URLDecoder.decode(name, "utf-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		/**
		 * return的字符串和全局视图名对应
		 */
		return "GOBAL";

	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
